package com.software.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.software.bean.OrderBean;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author wyj
 * @since 2024-04-04
 */
public interface OrderMapper extends BaseMapper<OrderBean> {

    List<OrderBean> getOrderListByBuyerId(Integer customerId);

    List<OrderBean> getProductForDeliveryList(Integer customerId);

    OrderBean selectByOrderNo(String orderNo);

    IPage<OrderBean> getOrderListForPage(Page<OrderBean> page);

    OrderBean getOrderInfoByOrderIdandCid(Integer orderId, Integer cid);

    OrderBean getOrderDetailByOid(Integer oid);

//    @Select("select COUNT(\n" +
//            "case when `status` = 1 then 1 ELSE null  end ) as '待付款'   , \n" +
//            " COUNT(\n" +
//            "case when `status` = 2 then 1 ELSE null  end ) as '待发货'   , \n" +
//            " COUNT(\n" +
//            "case when `status` = 3 then 1 ELSE null end ) as '待收货'   , \n" +
//            " COUNT(\n" +
//            "case when `status` = 4 then 1 ELSE null end ) as '已完成'   , \n" +
//            "count(case when `status` =5 then 1 ELSE null end  ) as '已取消'\n" +
//            " from tb_order ;  ")


    Map<String , Object> orderCharts();

    List<OrderBean> selectByIds(List<Integer> orderIdArray);
}
